package com.sijiao.common;

import java.util.UUID;

/**
 * 生成ID的公共方法
 *
 * @author ShiLian
 * @date 2022/07/23 01:41
 **/
public class CreateNumberId {

    /**
     * 生成字符串的uuid
     *
     * @return
     */
    public static String getUUID() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    /**
     * 生成纯数字的UUID
     *
     * @return 返回纯数字的UUID
     */
    public static Integer getUUIDInOrderId() {
        Integer orderId = 0;
        for (int i = 0; i < 100; i++) {
            orderId = UUID.randomUUID().toString().hashCode();
            orderId = orderId < 0 ? -orderId : orderId;
        }
        return orderId;
    }
}
